package com.baseDemo.web.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
/**
 * 系统图片持久化类
 * @author xianwei
 *
 */
@Entity
@Table(name = "T_UploadImageEntity")
public class UploadImageEntity implements Serializable{

	private static final long serialVersionUID = 4468598808975889786L;
	
	private String id;
	private byte[] imageFile;
	private String fileType;
	private String fileName;
	private Date uploadTime=new Date();

	private CommonsMultipartFile multipartFile;

	private String ownerEntity;
	private String ownerId;
	
	@Id
	@GeneratedValue(generator = "system-uuid")
	@GenericGenerator(name = "system-uuid", strategy = "org.hibernate.id.UUIDGenerator")
	@Column(length = 50)
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	@Lob
	@Basic(fetch = FetchType.LAZY)
	@Column(name = "imageFile", columnDefinition = "BLOB",nullable=true)
	public byte[] getImageFile() {
		return imageFile;
	}
	public void setImageFile(byte[] imageFile) {
		this.imageFile = imageFile;
	}
	@Column(length = 50)
	public String getFileType() {
		return fileType;
	}
	public void setFileType(String fileType) {
		this.fileType = fileType;
	}
	@Column(length = 50)
	public String getFileName() {
		return fileName;
	}
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(length = 25)
	public Date getUploadTime() {
		return uploadTime;
	}
	public void setUploadTime(Date uploadTime) {
		this.uploadTime = uploadTime;
	}
	@Column(length = 50)
	public String getOwnerEntity() {
		return ownerEntity;
	}
	public void setOwnerEntity(String ownerEntity) {
		this.ownerEntity = ownerEntity;
	}
	@Column(length = 50)
	public String getOwnerId() {
		return ownerId;
	}
	public void setOwnerId(String ownerId) {
		this.ownerId = ownerId;
	}
	@Transient
	public CommonsMultipartFile getMultipartFile() {
		return multipartFile;
	}
	public void setMultipartFile(CommonsMultipartFile multipartFile) {
		this.multipartFile = multipartFile;
	}
	
	
}
